﻿using System.Data;
using System.Data.SqlClient;

namespace MyWeb.Data
{
    public class SupportController : SqlDataProvider
    {
        #region [Support_GetByAll]

        public DataTable Support_GetByAll()
        {
            return GetDataTable("sp_Support_GetByAll");
        }

        #endregion

        #region [Support_GetById]

        public DataTable Support_GetById(int id)
        {
            var p1 = new SqlParameter("@id", id);
            return GetDataTable("sp_Support_GetById", p1);
        }

        #endregion

        #region [Support_Insert]

        public void Support_Insert(SupportInfo support)
        {
            var p1 = new SqlParameter("@name", support.Name);
            var p2 = new SqlParameter("@tel", support.Tel);
            var p3 = new SqlParameter("@type", support.Type);
            var p4 = new SqlParameter("@nick", support.Nick);
            var p5 = new SqlParameter("@order", support.Order);
            var p6 = new SqlParameter("@status", support.Status);
            ExecuteStoreProcedure("sp_Support_Insert", p1, p2, p3, p4, p5, p6);
        }

        #endregion

        #region [Support_Update]

        public void Support_Update(SupportInfo support)
        {
            var p0 = new SqlParameter("@id", support.Id);
            var p1 = new SqlParameter("@name", support.Name);
            var p2 = new SqlParameter("@tel", support.Tel);
            var p3 = new SqlParameter("@type", support.Type);
            var p4 = new SqlParameter("@nick", support.Nick);
            var p5 = new SqlParameter("@order", support.Order);
            var p6 = new SqlParameter("@status", support.Status);
            ExecuteStoreProcedure("sp_Support_Update", p0, p1, p2, p3, p4, p5, p6);
        }

        #endregion

        #region [Support_Delete]

        public void Support_Delete(int id)
        {
            var p0 = new SqlParameter("@id", id);
            ExecuteStoreProcedure("sp_Support_Delete", p0);
        }

        #endregion

        #region [Support_ActiveStatus]

        public void Support_ActiveStatus(int id, int status)
        {
            var p1 = new SqlParameter("@id", id);
            var p2 = new SqlParameter("@status", status);
            ExecuteStoreProcedure("sp_Support_ActiveStatus", p1, p2);
        }

        #endregion
    }
}